package org.jeecg.service.impl;

import cn.hutool.core.lang.UUID;
import lombok.SneakyThrows;
import org.jeecg.minio.impl.MinioFileStorageServiceImpl;
import org.jeecg.service.FileService;
import org.jeecg.utils.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

@Service
public class FileServiceImpl implements FileService {
    @Autowired
    private MinioFileStorageServiceImpl fileStorageService;
    @Override
    @SneakyThrows
    public ResponseResult uploadAvatarImg(MultipartFile file) {
        // 头像处理
        String uuid = UUID.randomUUID().toString(true);
        String path = fileStorageService.uploadImgFile("fzy", uuid + ".jpg", file.getInputStream());
        System.out.println("-------------------------");
        System.out.println(path);
        return ResponseResult.okResult(200000,path);
    }
}
